package com.kx.kxblog.controller;

import com.kx.kxblog.annotation.PermissionLimit;
import com.kx.kxblog.bean.Group;
import com.kx.kxblog.bean.Result;
import com.kx.kxblog.entity.Site;
import com.kx.kxblog.enums.Permission;
import com.kx.kxblog.enums.ResultCode;
import com.kx.kxblog.exception.ResultException;
import com.kx.kxblog.service.SiteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "站点")
@RequestMapping("/site")
@RestController
public class SiteController extends AbstractController<Site, Integer, SiteService> {
    @PermissionLimit
    @GetMapping("/my")
    @ApiOperation(value="获取我的站点")
    public Site my(){
        return service.my();
    }

    @Override
    @PermissionLimit(Permission.NO)
    @ApiOperation(value = "", hidden = true)
    public Site create(Site entity) {
        return super.create(entity);
    }

    @Override
    @PermissionLimit(Permission.NO)
    @ApiOperation(value = "", hidden = true)
    public Site modifyById(@Validated(Group.ById.class) @RequestBody Site entity) {
        return super.modifyById(entity);
    }
}
